
import os
import pytest
from pytest_jsonreport.plugin import JSONReport
from weCom.send import Robot

if __name__ == '__main__':
    plugin = JSONReport()

    pytest.main(["-s", "-v", "./testCase/test_api.py", "--alluredir=./testReportData/unit",
                 "--junit-xml=./testReportData/xml/report.xml"], plugins=[plugin])

    summary = plugin.report.get("summary")
    passed = summary.get("passed", 0)
    failed = summary.get("failed", 0)
    skipped = summary.get("skipped", 0)
    error = summary.get("error", 0)
    total = summary.get("total", 0)

    Robot().send_message(total, passed, failed, skipped, error)

    # os.system("pytest -s ./testCase/test_api.py --alluredir=./testReportData/unit")




































